package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;

// 集合
public class CollectionDemoOne {
    public static void main(String[] args) {
        //Collection c = new ArrayList();
        Collection c = new HashSet();
        c.add("hello");
        c.add("world");
        c.add("java");
        boolean b = c.add("java");
        System.out.println(b);// false
        boolean d = c.add("you");
        System.out.println(d);// true
        System.out.println(c);
        System.out.println(c.size());
        System.out.println("是否是空集："+c.isEmpty());
        c.clear();// 清空集合
        System.out.println(c);// []
        System.out.println(c.size());// 0
        System.out.println("是否是空集："+c.isEmpty());// true
    }
}
